﻿@model Developer.Entity.Reviews

@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/css/bootstrap.min.css" />
    <link rel="stylesheet" href="~/Content/plugins/summernote/css/codemirror.css" />
    <link rel="stylesheet" href="~/Content/plugins/summernote/css/monokai.css" />
    <link rel="stylesheet" href="~/Content/plugins/summernote/dist/summernote-bs4.css" />
    <link rel="stylesheet" href="~/Content/plugins/summernote/dist/summernote.css" />
    <link href="~/Content/UI/css/mui.min.css" rel="stylesheet" />
    <link href="~/Content/UI/css/mdui.min.css" rel="stylesheet" />
    <link href="~/Assets/Plugs/HUI/webuploader/0.1.5/webuploader.css" rel="stylesheet" />
    <style>
        .right{
            float:right;
        }
    </style>
</head>
<body>
    <form action="/Review/EditReview?uid=@ViewBag.uid" method="post">
        <header class="mui-bar mui-bar-nav">
            <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
            <h1 class="mui-title">编辑书评</h1>
            <button class="mui-btn mui-btn-blue mui-btn-link mui-pull-right" type="submit" onclick="getContent()">保存</button>
        </header>
        <div class="mui-content" style="height:100%">


            @if (Model.Contents.IsEmpty())
            {
                    <div class="form-group" style="margin-top:5px;">
                        @Html.Label("封面", htmlAttributes: new { @class = "control-label col-md-2", @style = "margin-bottom:0px;" })
                        <div class="col-md-10">
                            <div class="uploader-list-container">
                                <div class="queueList">
                                    <div id="dndArea" class="placeholder">
                                        <div id="filePicker-2"></div>
                                        <p>请上传封面图，格式为png或jpg、jpeg，不超过1MB</p>
                                        <input type="hidden" name="Img" value="" id="uploaderImg" />
                                    </div>
                                </div>
                                <div class="statusBar" style="display:none">
                                    <div class="progress"><span class="text">0%</span><span class="percentage"></span> </div>
                                    <div class="info"></div>
                                    <div class="btns">
                                        <div class="filePicker2"></div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="mdui-textfield mdui-textfield-floating-label">
                        @Html.Label("标题", htmlAttributes: new { @class = "mdui-textfield-label" })
                            @Html.EditorFor(model => model.Title, new { htmlAttributes = new { @class = "mdui-textfield-input", @required = "", @placeholder = "", @maxlength = "15" } })

                        </div>
                        
                    </div>
                    <div class="form-group">
                        <div class="mdui-textfield mdui-textfield-floating-label">
                        @Html.Label("题记", htmlAttributes: new { @class = "mdui-textfield-label" })
                            @Html.EditorFor(model => model.SubTitle, new { htmlAttributes = new { @class = "mdui-textfield-input", @required = "", @placeholder = "", @maxlength = "50" } })

                        </div>
                        
                    </div>

                    <div class="form-group">
                        @Html.Label("正文", htmlAttributes: new { @class = "control-label col-md-2" })
                        <div class="col-md-10">
                            @Html.TextAreaFor(model => model.Contents, new { @class = "form-control note-codable summernote", @id = "summernote" })
                            @*<div id="summernote" class="form-control note-codable summernote">@Model.Contents</div>*@
                        </div>
                    </div>
                    <div class="form-group">
                        <input type="hidden" value="" name="Contents" id="Contents" />
                    </div>

            }
            else
            {
                    <div class="form-group" style="margin-top:5px;">
                        @Html.Label("封面", htmlAttributes: new { @class = "control-label col-md-2", @style = "margin-bottom:0px;" })
                        <div class="col-md-10">
                            <div class="uploader-list-container">
                                <div class="queueList">
                                    <div id="dndArea" class="placeholder">
                                        <div id="filePicker-2"></div>
                                        <p>请上传封面图，格式为png或jpg、jpeg，不超过1MB</p>
                                        <input type="hidden" name="Img" value="@Model.Img" id="uploaderImg" />
                                    </div>
                                </div>
                                <div class="statusBar" style="display:none">
                                    <div class="progress"><span class="text">0%</span><span class="percentage"></span> </div>
                                    <div class="info"></div>
                                    <div class="btns">
                                        <div class="filePicker2"></div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="mdui-textfield mdui-textfield-floating-label">
                        @Html.Label("标题", htmlAttributes: new { @class = "mdui-textfield-label" })
                            @Html.EditorFor(model => model.Title, new { htmlAttributes = new { @class = "mdui-textfield-input", @required = "", @value = Model.Title, @placeholder = "", @maxlength = "15" } })

                        </div>
                    </div>
                    <div class="form-group">
                        <div class="mdui-textfield mdui-textfield-floating-label">
                        @Html.Label("题记", htmlAttributes: new { @class = "mdui-textfield-label" })
                            @Html.EditorFor(model => model.SubTitle, new { htmlAttributes = new { @class = "mdui-textfield-input", @required = "", @value = Model.SubTitle, @placeholder = "", @maxlength = "50" } })

                        </div>
                    </div>
                    <div class="form-group">
                        @Html.Label("正文", htmlAttributes: new { @class = "control-label col-md-2" })
                        <div class="col-md-10">
                            @Html.TextAreaFor(model => model.Contents, new { @class = "form-control note-codable summernote", @id = "summernote" })
                            @*<div id="summernote" class="form-control note-codable summernote">@Model.Contents</div>*@
                        </div>
                    </div>
                    <div class="form-group">
                        <input type="hidden" value="" name="Contents" id="Contents" />
                        <input type="hidden" value="@Model.Id" name="rid" />
                    </div>
            }
        </div>
        </form>
        <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
        <script src="~/Content/UI/js/mui.min.js"></script>
        <script type="text/javascript" src="~/Content/UI/js/mdui.min.js"></script>
        <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/js/bootstrap.min.js"></script>
        <script type="text/javascript" src="~/Content/plugins/summernote/codemirror/codemirror.js"></script>
        <script type="text/javascript" src="~/Content/plugins/summernote/codemirror/formatting.js"></script>
        <script type="text/javascript" src="~/Content/plugins/summernote/codemirror/xml.js"></script>
        <script type="text/javascript" src="~/Content/plugins/summernote/dist/summernote.js"></script>
        <script type="text/javascript" src="~/Content/plugins/summernote/dist/lang/summernote-zh-CN.js"></script>
        <script type="text/javascript" src="~/Content/plugins/summernote/summernote-initialization.js"></script>
        <script type="text/javascript" src="~/Content/plugins/summernote/codemirror/css.js"></script>
        <script src="~/Assets/Plugs/HUI/webuploader/0.1.5/webuploader.min.js"></script>
        <script src="~/Assets/Scripts/js.js"></script>
        <script>
            init_uploader(1);
            function getContent() {
                var content = $('#summernote').code();
                $('#Contents').val(content);
            }
        </script>

</body>
</html>
